package org.example.netty.test.nio.netty.chat.common;

import org.example.netty.test.nio.netty.chat.bean.*;

import java.util.HashMap;
import java.util.Map;

/**
 * @author zp
 * @version 1.0
 * @description: 消息的类型
 * @date 2023/4/1 16:02
 */
public class MessageType {
    public static Map<Integer, Class<?>> messageTypeMap = new HashMap<>();
    static {
        messageTypeMap.put(MessageType.MESSAGE_TYPE_SYSTEM, SystemMessage.class);
        messageTypeMap.put(MessageType.MESSAGE_TYPE_LOGIN, LoginMessage.class);
        messageTypeMap.put(MessageType.MESSAGE_TYPE_LOG_OUT, LogoutMessage.class);
        messageTypeMap.put(MessageType.MESSAGE_TYPE_SEND_USER, SendUserMessage.class);
        messageTypeMap.put(MessageType.MESSAGE_TYPE_SEND_GROUP, SendGroupMessage.class);
        messageTypeMap.put(MessageType.MESSAGE_TYPE_JOIN_GROUP, JoinGroupMessage.class);
        messageTypeMap.put(MessageType.MESSAGE_TYPE_OUT_GROUP, OutGroupMessage.class);
        messageTypeMap.put(MessageType.MESSAGE_TYPE_OUT_USER, OutUserMessage.class);
        messageTypeMap.put(MessageType.MESSAGE_TYPE_JOIN_USER, JoinUserMessage.class);
        messageTypeMap.put(MessageType.MESSAGE_TYPE_REGISTER, RegisterMessage.class);

        messageTypeMap.put(MessageType.MESSAGE_TYPE_CREATE_GROUP, CreateGroupMessage.class);
        messageTypeMap.put(MessageType.MESSAGE_TYPE_ALL_USER_LIST, GetALLUserMessage.class);
        messageTypeMap.put(MessageType.MESSAGE_TYPE_ALL_GROUP_LIST, GetALLGroupNameMessage.class);
        messageTypeMap.put(MessageType.MESSAGE_TYPE_ADD_USER_LIST, GetAddUserMessage.class);
        messageTypeMap.put(MessageType.MESSAGE_TYPE_ADD_GROUP_LIST, GetAddGroupNameMessage.class);
        messageTypeMap.put(MessageType.MESSAGE_TYPE_PING, PingMessage.class);
        messageTypeMap.put(MessageType.MESSAGE_TYPE_RPC_RESPONSE, RpcResponse.class);
        messageTypeMap.put(MessageType.MESSAGE_TYPE_RPC_REQUEST, RpcRequest.class);
    }

    public static final int MESSAGE_TYPE_SYSTEM = 99;
    public static final int MESSAGE_TYPE_LOGIN = 0;
    public static final int MESSAGE_TYPE_LOG_OUT = 1;
    public static final int MESSAGE_TYPE_SEND_USER = 2;
    public static final int MESSAGE_TYPE_SEND_GROUP = 3;

    public static final int MESSAGE_TYPE_JOIN_GROUP = 4;

    public static final int MESSAGE_TYPE_OUT_GROUP = 5;

    public static final int MESSAGE_TYPE_OUT_USER = 6;
    public static final int MESSAGE_TYPE_JOIN_USER = 7;

    public static final int MESSAGE_TYPE_REGISTER = 8;

    public static final int MESSAGE_TYPE_CREATE_GROUP = 9;

    public static final int MESSAGE_TYPE_ALL_USER_LIST = 10;

    public static final int MESSAGE_TYPE_ALL_GROUP_LIST = 11;

    public static final int MESSAGE_TYPE_ADD_USER_LIST = 12;

    public static final int MESSAGE_TYPE_ADD_GROUP_LIST = 13;

    public static final int MESSAGE_TYPE_PING = 14;

    public static final int MESSAGE_TYPE_RPC_REQUEST = 15;

    public static final int MESSAGE_TYPE_RPC_RESPONSE = 16;

}
